import React, { Component } from "react";
import ReactSwiper from "react-swipe";


export default class Mine extends Component {
    render() {
        // swipes 的配置
        // swipes 的配置
        let opt = {
            distance: 620, // 每次移动的距离，卡片的真实宽度
            currentPoint: 1,// 初始位置，默认从0即第一个元素开始
            autoPlay: true, // 是否开启自动播放
            continuous: true,
            swTouchstart: (ev) => {

            },
            swTouchmove: (ev) => {

            },
            swTouchend: (ev) => {
                let data = {
                    moved: ev.moved,
                    originalPoint: ev.originalPoint,
                    newPoint: ev.newPoint,
                    cancelled: ev.cancelled
                }
                this.setState({
                    curCard: ev.newPoint
                })
            }
        }
        let { slider } = this.props;
        return (<div>
            {
                slider.length > 0 ?
                    <ReactSwiper
                        swipeOptions={opt}
                        className="carousel"
                    >
                        {
                            slider.map((item, index) => (
                                <div key={index}>
                                    <img src={"https://img12.360buyimg.com/cms/s750x264_" + item.bannerImage} />
                                </div>
                            ))
                        }
                    </ReactSwiper> : null
            }
        </div>
        )
    }
}